CREATE TABLE [dbo].[TASALD_CORP]
(
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NOT NULL CONSTRAINT [DF__TASALD_CO__NU_AN__00551192] DEFAULT (datepart(year,getdate())),
[NU_MESE] [dbo].[TD_IN_002_MESE] NOT NULL,
[CO_CNTA_CORP] [dbo].[TD_VC_020_CNTA] NOT NULL,
[TI_AUXI_CORP] [dbo].[TD_VC_001] NULL,
[CO_AUXI_CORP] [dbo].[TD_VC_020] NULL,
[IM_CARG_MESE] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TASALD_CO__IM_CA__0425A276] DEFAULT ((0)),
[IM_ABON_MESE] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TASALD_CO__IM_AB__060DEAE8] DEFAULT ((0)),
[PR_DATO] [dbo].[TD_VC_020] NOT NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TASALD_CO__FE_US__07F6335A] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TASALD_CO__FE_US__08EA5793] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TASALD_CORP] ADD CONSTRAINT [CK__TASALD_CO__CO_CN__03317E3D] CHECK (([CO_CNTA_CORP]>='0' AND [CO_CNTA_CORP]<='99999999999999999999'))
GO
ALTER TABLE [dbo].[TASALD_CORP] ADD CONSTRAINT [CK__TASALD_CO__IM_AB__07020F21] CHECK (([IM_ABON_MESE]>=(0)))
GO
ALTER TABLE [dbo].[TASALD_CORP] ADD CONSTRAINT [CK__TASALD_CO__IM_CA__0519C6AF] CHECK (([IM_CARG_MESE]>=(0)))
GO
ALTER TABLE [dbo].[TASALD_CORP] ADD CONSTRAINT [CK__TASALD_CO__NU_AN__014935CB] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TASALD_CORP] ADD CONSTRAINT [CK__TASALD_CO__NU_ME__023D5A04] CHECK (([NU_MESE]>=(0) AND [NU_MESE]<=(13)))
GO
CREATE NONCLUSTERED INDEX [ITASALD_CORP_01] ON [dbo].[TASALD_CORP] ([NU_ANNO], [NU_MESE], [TI_AUXI_CORP], [CO_AUXI_CORP]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TASALD_CORP] ADD CONSTRAINT [TMPLAN_CORP_A_TASALD_CORP] FOREIGN KEY ([CO_CNTA_CORP]) REFERENCES [dbo].[TMPLAN_CORP] ([CO_CNTA_CORP])
GO
